<script lang="ts" setup>
import WalletOrderTable from './components/wallet-order-table.vue'
import WalletOrderQuery from './components/wallet-order-query.vue'
import { useTableHelper } from '@/components/base/table/table-helper'
import { api } from '@/utils/api-instance'
import { provide } from 'vue'
import type { WalletOrderSpec } from '@/apis/__generated/model/static'
import { useQueryHelper } from '@/components/base/query/query-helper'

const initQuery: WalletOrderSpec = {}
const tableHelper = useTableHelper(
  api.walletOrderForAdminController.query,
  api.walletOrderForAdminController,
  initQuery,
)
const { query, restQuery } = useQueryHelper<WalletOrderSpec>(initQuery)
provide('walletOrderTableHelper', tableHelper)
</script>
<template>
  <div class="wallet-order-view">
    <wallet-order-query
      v-model:query="query"
      @reset="restQuery"
      @search="tableHelper.reloadTableData({ query })"
    ></wallet-order-query>
    <wallet-order-table></wallet-order-table>
  </div>
</template>

<style lang="scss" scoped>
.wallet-order-view {
  background: white;
  padding: 20px;
  border-radius: 5px;
}
</style>
